﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;//提供了关于文件、数据流的读取和写入操作
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;//提供了用于与事件日志、性能计数器和系统进程进行交互的类

namespace 实现简单注册窗体
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string name;
            //SaveFileDialog类
            SaveFileDialog save = new SaveFileDialog();
            //过滤器
            save.Filter = "*.txt|*.TXT|(*.*)|*.*";
            //显示
            if (save.ShowDialog() == DialogResult.OK)
            {
                name = save.FileName;
                FileInfo info = new FileInfo(name);
                //info.Delete();
                StreamWriter writer = info.CreateText();
                writer.Write(textBox1.Text);
                writer.Close();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.WordWrap == false)
            {
                textBox1.WordWrap = true;
                button1.Text = "取消自动换行";
            }
            else
            {
                textBox1.WordWrap = false;
                button1.Text = "自动换行";
            }
            
            
        }
    }
}
